

local app = require 'app'
local Room = require 'entities.Room'
local game = app.game.running

local M = game.kbe.entity('DoudizhuRoom', Room)

function M:__init__()
    Room.__init__(self)
end

function M:on_phase(phase_id)
    self.log.debug(string.format('on_phase:%s', phase_id))
    game.store.ingame.on_phase(phase_id)
end

function M:on_restart()
    self.log.debug(string.format("on_restart"))
    game.store.ingame.on_restart()
end

function M:on_seen_cards(card_ids)
    self.log.debug(string.format("on_seen_cards card_ids:%s", app.dump(card_ids)))
    game.store.ingame.on_seen_cards(card_ids)
end

function M:on_notice_lord(no)
    self.log.debug(string.format("on_notice_lord no:%s", no))
    game.store.ingame.on_notice_lord(no)
end

function M:req_player_bid(no, action_ids, time)
    self.log.debug(string.format("req_player_bid no:%s action_ids:%s time:%s", no, app.dump(card_ids), time))
    game.store.ingame.req_player_bid({no = no, action_ids = action_ids, time = time})
end

function M:on_player_bid_result(no, action_id)
    self.log.debug(string.format('on_player_bid_result no:%s action_id:%s', no, action_id))
    game.store.ingame.on_player_bid_result({no = no, action_id = action_id})
end

function M:req_player_handout(no, time, round_first)
    self.log.debug(string.format('req_player_handout no:%s time:%s round_first:%s',  no, time, round_first))
    game.store.ingame.req_player_handout({no = no, time = time, round_first = round_first})
end

function M:on_player_handout_result(no, card_ids)
    self.log.debug(string.format('on_player_handout_result no:%s card_ids:%s card_type',  no, app.dump(card_ids), card_type))
    game.store.ingame.on_player_handout_result({no = no, card_ids = card_ids})
end

function M:on_over(detail)
    self.log.debug(string.format('on_over %s', app.dump(detail)))
    game.store.ingame.on_over(detail)
end

return M